<template>
  <div>
    <FuWenBen ref="child" id="tinymce" @release="release" jude="2" :content="content"></FuWenBen>
     <button class="btn" @click="setPages">发布文章</button>
  </div>
</template>

<script>
import FuWenBen from "@/components/FuWenBen";
export default {
name: "BlogUpdate",
  data(){
    return {
      content:'',
      id:this.$route.query.id
    }
  },
  components:{
  FuWenBen
  },
  methods:{
    setPages(){
        this.$refs.child.release();
    },
     release(content){
       var request = this.myCode();
       var configThree = {
         method: 'post',
         url: '/BlogUpdate',
         data: {
           id:this.id,
           content:content
         }
       }
       request(configThree).then((res) => {
         console.log(res);
       if (res.data.status == 200){
         alert('更新成功');
       }
       })
     }
  },
  created() {
    const request = this.myCode();
    const config = {
      method:'get',
      url:'/GetBlogContent',
      params:{
        'id':this.id
      },
    }
    request(config).then(res=>{
        this.content = res.data.data[0].content;
    })
  }
}
</script>

<style scoped>

</style>